﻿using System;
using System.Linq;
using LinqExpressions = System.Linq.Expressions;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Silverlight.Testing;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Reflection;
using System.Windows.Threading;

using Caliburn.Micro.BikeWizard.Tests.BaseClasses;
using Caliburn.Micro.BikeWizard.Tests.Utils;
using Caliburn.Micro.BikeWizard.Views;
using Caliburn.Micro.BikeWizard.Utils;

namespace Caliburn.Micro.Wizard.Tests
{
    /// <summary>
    /// </summary>
    [TestClass]
    public class ServiceTests : TestBase
    {
        #region Tests
        [TestMethod]
        [Asynchronous]
        public void BikeOptionServiceTest()
        {
            new CoroutineExecutor(BikeOptionServiceTestImpl()).Execute(null);
        }
        #endregion

        #region Test Implementations
        private IEnumerable<IResult> BikeOptionServiceTestImpl()
        {
            yield return bikeOptionService.ClearData();
            yield return new TestDataHelper().SetupTestData(bikeOptionService);
            yield return bikeOptionService.GetAvailableBikeTypes();
            yield return new ActionResult(
                (actionResult) =>
                {
                    Assert.AreEqual(5, bikeOptionService.BikeTypes.Count());
                    actionResult.SetComplete(this);
                });
            yield return bikeOptionService.GetAvailableFrameSizes();
            yield return new ActionResult(
                (actionResult) =>
                {
                    Assert.AreEqual(3, bikeOptionService.FrameSizes.Count());
                    actionResult.SetComplete(this);
                });
            yield return bikeOptionService.GetAvailablePartsGroups();
            yield return new ActionResult(
                (actionResult) =>
                {
                    Assert.AreEqual(3, bikeOptionService.PartsGroups.Count());
                    actionResult.SetComplete(this);
                });
            yield return bikeOptionService.GetAvailableExtras();
            yield return new ActionResult(
                (actionResult) =>
                {
                    Assert.AreEqual(6, bikeOptionService.Extras.Count());
                    actionResult.SetComplete(this);
                });
            yield return SetTestComplete();
        }
        #endregion
    }
}
